#include "BlackPinePlugin.h"
#include <sys/time.h> /* gettimeofday */

class DatePlugin : public BlackPinePlugin
{
public:
  DatePlugin() {};
  ~DatePlugin() {};
  void process(std::ostringstream& strm, const std::vector<std::string>& args)
  {
    char now[256];
    time_t timer = time(NULL);
    struct tm *date = localtime(&timer);
    strftime(now, 255, args.empty() ? "%Y-%m-%d %H:%M:%S" : args[0].c_str(), date);
    strm << now;
  };
};

BlackPinePlugin* create_plugin()
{
  return new DatePlugin();
}
